import { defHttp } from '/@/utils/http/axios';

enum Api {
  list = '/api-workflow/wf/processInstance/list',
  get = '/api-workflow/wf/processInstance/detail',
  startAndExecute = '/api-workflow/wf/processInstance/startAndExecute',
  highLight = '/api-workflow/wf/processInstance/highLight',
  approvalRecord = '/api-workflow/wf/processInstance/approvalRecord',
  withdraw = '/api-workflow/wf/processInstance/withdraw',
  ccList = '/api-workflow/wf/processInstance/ccList',
}

/**
 * 分页查询流程设计列表
 * @param params 查询参数
 * @returns
 */
export const list = (params) => defHttp.get({ url: Api.list, params });

/**
 * 获取流程定义详情
 * @param params 查询参数
 * @returns
 */
export const getProcessInstanceById = (params) => {
  return defHttp.get({ url: Api.get, params });
};

/**
 * 发起流程
 * @param params 参数
 * @returns
 */
export function startAndExecuteProcessInstance(params) {
  return defHttp.post({ url: Api.startAndExecute, params });
}

/**
 * 获取流程实例高亮数据
 * @param params 查询参数
 * @returns
 */
export function getHighLightProcessInstance(params) {
  return defHttp.get({ url: Api.highLight, params });
}

/**
 * 获取流程审批记录
 * @param params 查询参数
 * @returns
 */
export function getApprovalRecordProcessInstance(params) {
  return defHttp.get({ url: Api.approvalRecord, params });
}

/**
 * 撤回流程
 * @param params 查询参数
 * @returns
 */
export function withdrawProcessInstance(params) {
  return defHttp.post({ url: Api.withdraw, params });
}

/**
 * 分页查询抄送列表
 * @param params 查询参数
 * @returns
 */
export function getProcessInstanceCcList(params) {
  return defHttp.post({ url: Api.ccList, params });
}
